home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / tablePlug / rx / ae_blackb.tpx next >
Text File  |  1999-10-11  |  1KB  |  65 lines

  1. /*
  2.  
  3.     ae_blackb.tpx v1.1 © 1999 Esteve Boix
  4.  
  5.     Uses ArtEffect to load and scale the image, and
  6.     paints a black border around it.
  7.  
  8.     Tested with ArtEffect3, should work on v2 (and v1 ???).
  9.  
  10.     Args: SIZEX SIZEY JPEG_COMPRESSION
  11.  
  12.     Where:
  13.  
  14.         SIZEX, SIZEY        Size in pixels of the thumbnail
  15.         JPEG_COMPRESSION    Well...
  16.  
  17. */
  18.  
  19. options results
  20.  
  21. parse arg maxsizex maxsizey compression infile outfile
  22.  
  23. infile=strip(infile)
  24. outfile=strip(outfile)
  25.  
  26. address 'ArtEffect'
  27. LockGui
  28. LoadPic '"'infile'"'
  29.  
  30. /* Obtain info about the image */
  31. get stem size. pictureinfo
  32.  
  33. x = size.width
  34. y = size.height
  35.  
  36. /* ...and calculate the thumbnail resolution */
  37.  
  38. comp=trunc((maxsizex/x)*y)
  39.  
  40. if comp<=maxsizey then do
  41.  
  42.  
  43.     scalepic maxsizex comp
  44.     end
  45.  
  46. else do
  47.                                     /* No */
  48.  
  49.     comp2=trunc((maxsizey/y)*x)
  50.     scalepic comp2 maxsizey
  51.  
  52. end
  53.  
  54. /* Black rectangle */
  55. get stem size. pictureinfo
  56. setcolor r 0 g 0 b 0
  57. changebrush sw 1 sh 1
  58. rectangle 0 0 (size.width-1) (size.height-1) pt pen str 100
  59.  
  60. /* And save the image */
  61.  
  62. SavePic '"'outfile'"' plugin 'JFIF-JPEG' quality '"'||compression||'"'
  63. ClosePic
  64. UnLockGui
  65.